package com.zxn.ssyx.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zxn.ssyx.mapper.RoleMapper;
import com.zxn.ssyx.model.acl.Role;
import com.zxn.ssyx.service.RoleService;
import com.zxn.ssyx.vo.acl.RoleQueryVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Optional;

@Service
public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements RoleService {
    @Autowired
    private RoleMapper roleMapper;
    @Override
    public IPage<Role> index(Page<Role> pageParam, RoleQueryVo roleQueryVo) {
        LambdaQueryWrapper<Role> lqw = new LambdaQueryWrapper<>();
        // 根据名字条件模糊查询
        if (roleQueryVo.getRoleName() != null){
            lqw.like(Role::getRoleName,roleQueryVo.getRoleName());
        }
        return roleMapper.selectPage(pageParam,lqw);
    }
}
